//list页面
"use strict";

/**
* @param this 当前模块上下文，通过上下文获取模块内的组件可以避免DOM ID冲突，也可以通过此对象来暴露对象（eg: this.[property]）
* @param $ jQuery对象
* @param ctx 模块上下文容器，可以通过此对象获取其他模块上下文并调用其暴露的对象（eg: ctx.[moduleName].property）
* @param global window对象的引用，暴露全局
*/
modules.list = function($, ctx, global) {
	var $$ = this;
	
	var _dg = $$('#dg');
	_dg.datagrid({
		title: '<i class="fa fa-newspaper-o"></i> 资产查看',
		//iconCls:'icon-search',
		url:'datagrid_data1.json',
		method:'get',
		border:false,
		singleSelect: false,
		ctrlSelect: true,
		fit:true,
		fitColumns:true,
		pagination:true,
		toolbar: [
			{
				text: '<i class="fa fa-times"></i> 删除',
				handler: function(){
					var records = _dg.datagrid('getSelections');
					if (records.length) {
						l(records);
					} else {
						$.messager.alert('提示','未选中任何记录', 'info');
					}
				}
			},'-',{
				text: '<i class="fa fa-question"></i> 帮助',
				handler: function(){
					$.messager.show({
						msg:'双击查看详细记录',
						showType:'slide',
						showSpeed: 200,
						timeout: 1000,
						style:{
							right:'',
							top: '',
							bottom: -document.body.scrollTop - document.documentElement.scrollTop
						}
					});
				}
			}
		],
		multiSort:true,
		scrollbarSize: 0,
		rownumbers: true,
		idField: 'id',
		//striped: true,
		queryParams: {
			
		},
		onDblClickRow: function(index,row) {
			console.log(index,row)
		},
		columns:[[
			{field:'id', checkbox:true},
			{field:'itemid', title:'编号', width: 100, halign:'center', sortable:true},
			{field:'productid', title:'产品ID', width: 100, sortable:true},
			{field:'listprice', title:'标价', width: 100},
			{field:'unitcost', title:'单价', width: 100},
			{field:'attr1', title:'属性', width: 100},
			{field:'status', title:'状态', width: 100}
		]]
	});
	_dg.datagrid('reload');
	
};